import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Antd from 'ant-design-vue'
import 'ant-design-vue/dist/antd.css'
import { VueAxios } from './utils/request'
//引入echart
import echarts from 'echarts'
//将echarts引入到vue的原型中
Vue.prototype.$echarts = echarts

Vue.use(Antd)
import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(Element)


import ECharts from 'vue-echarts'
// 注册全局的组件
Vue.component('vChart', ECharts)

//路由守卫，手机端和移动端的路由不一样
// router.beforeEach((to, from, next) => {
//   //判断移动端/pc端访问
//   let pcStatus = !navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)
//   //路由拦截，防止移动端访问pc端了路由或相反
//   if (!to.meta.isPc && pcStatus) {  //如果当前是pc端，却访问了移动端的路由
//     let path = to.path==='/M_Index' ? '/Home' : to.path.replace('M_', "");
//     next({
//       path:`${path}`
//     })
//   } else if(to.meta.isPc && !pcStatus){   //如果当前是移动端，却访问了pc端的路由
//     let path = to.path==='/' || to.path==='/Home' ? '/M_Index' : to.path.replace('/', "/M_");
//     next({
//       path:`${path}`
//     })
//   }else {
//     next();
//   }
// });

//页面跳转滚动条归零
// router.afterEach((to,from,next) => {
//   window.scrollTo(0,0);
// });
Vue.use(VueAxios)
Vue.prototype.apiServer = '' //新地址
new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app')